﻿using System;
using lpn = LProject.Phone.Net;

namespace FITClub.Episode1.Controller
{
    internal class RemotePhonePlayer : APlayer
    {
        private lpn.MulticastClient client;

        private RemoteGamepadReceiver gamepad;

        private byte id;

        public RemotePhonePlayer(string name, byte gamepadid, lpn.MulticastClient client)
            : base(name)
        {
            this.gamepad = new RemoteGamepadReceiver(client);
            this.client = client;
            this.id = gamepadid;
        }

        public override void Dispose()
        {
            gamepad.Dispose();
        }

        public override void Update()
        {
            base.Update();
            gamepad.Update();
            this.ControllerStateActual = gamepad.GetState(id);
        }
    }
}